const moveArr = [12,32,5,21,29,30,2,15,7,16,32,6,20,17,13,25,27,33,19,14,24,9,
  28,18,16,34,3,19,12,23,4,34,36,10,20,11,8]
export function encrypt(plainText) {
  let length = plainText.length
  let arrRes = new Array(mathPowerValue(2 * length))
  let count = 0;
  let index = Math.floor(Math.random() * moveArr.length)
  let startIndex = index;
  for (let i = 0; i < length; i++) {
    let c = plainText.charCodeAt(i)
    c += moveArr[index++]
    if (c > 126) {
      c -= 94
    }
    arrRes[count++] = c
    arrRes[count++] = getRandomNum()

    index %= moveArr.length
  }
  arrRes[1] = startIndex + 33
  arrRes[3] = length + arrRes[1]
  for (; count < arrRes.length; count++) {
    arrRes[count] = getRandomNum()
  }
  return arrRes.join(",")
}
function mathPowerValue(cap) {
  let n = cap - 1;
  n |= n >>> 1;
  n |= n >>> 2;
  n |= n >>> 4;
  n |= n >>> 8;
  n |= n >>> 16;
  return (n < 0) ? 1 : n + 1;
}
function getRandomNum() {
  return Math.floor(Math.random() * 94) + 33
}
